#ifndef __HEMUMem_H__
#define __HEMUMem_H__
#include<iostream>
#include<vector>
#include <cassert>
#include <cstddef>
#include"HEMUIRCode.h"

#define MEM_SIZE 1048576

size_t get_size(HEMUIRType tp);
size_t get_bsize(HEMUIRBtype tp);

size_t hstore(char* addr, const HEMUIRVar& var);
size_t hstore(char* addr, HEMUIRType tp, const std::vector<HEMUIRVar>& vars);
size_t hstore(char* addr, HEMUIRType tp, bool zero);
bool valid_addr(char* addr);
HEMUIRVar hload(char* addr, HEMUIRBtype tp);

class HEMUStack {
public:
	int64_t mem[MEM_SIZE];
	char* top = (char*)(&mem[MEM_SIZE]);
public:
	char* salloc(HEMUIRType tp, size_t align);
	bool free(char* otop);
};

class HEMUGMem {
public:
	int64_t mem[MEM_SIZE];
	char* top = (char*)(mem);
public:
	char* galloc(HEMUIRType tp, size_t align);
	bool free(char* otop);
};





















#endif